package world.snowcrystal.service;

import org.junit.jupiter.api.Test;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

public class CastToDouble {

    @Test
    public void test() throws InterruptedException {
        Long timestamp = System.currentTimeMillis();
        System.out.println(timestamp);
//        System.out.println(Long.toBinaryString(timestamp));
//        System.out.println(Long.toHexString(timestamp));
//        System.out.println(Double.PRECISION);
//
//        long rightShifted = timestamp >> 0L;
//        System.out.println("Right shifted ");
//        System.out.println(rightShifted);
//        System.out.println("binary string length : "+ Long.toBinaryString(rightShifted).length()+" " +Long.toBinaryString(rightShifted));
//        System.out.println(Long.toHexString(rightShifted));
//
//        Long dest = (0xffffffffffffffffL << (64L-9L) )- 0x8000000000000000L;
//        String bin = Long.toBinaryString(dest);
//        System.out.println(bin);
//        System.out.println(bin.length());
//        int numOne = 0;
//        for (char c : bin.toCharArray()) {
//            if(c == '1')
//            {
//                numOne++;
//            }
//        }
//        System.out.println(numOne);
//        Duration duration = Duration.ofMillis(dest - timestamp);

        System.out.println(timestamp.doubleValue());
        TimeUnit.SECONDS.sleep(12L);
        System.out.println(Long.valueOf(System.currentTimeMillis()).doubleValue());

    }
}
